﻿--HEADER Analytics.State.ProcessorCode

DECLARE @PK_Name nvarchar(100)

SELECT @PK_Name = name
FROM sys.key_constraints
WHERE type = 'PK' AND parent_object_id = object_id(N'[Analytics].[State]');


EXEC ('ALTER TABLE [Analytics].[State] DROP CONSTRAINT ' + @PK_Name);

GO

DELETE FROM [Analytics].[State]

GO

ALTER TABLE [Analytics].[State]
ADD ProcessorCode TINYINT NOT NULL

GO

ALTER TABLE [Analytics].[State]
ADD CONSTRAINT PK_State PRIMARY KEY (FundBookEntityId, ProcessorCode)